public T GetObject<T>(int objectId) where T: EngineObject
{
if (m_objectInstances.ContainsKey(typeof(T)))
{
List<EngineObject> objectList = m_objectInstances[typeof(T)];
return (T) objectList.Find(delegate(EngineObject obj) { return obj.ID == objectId; });
}
return default(T);
}
Or
public T GetObject<T>(int objectId) where T: EngineObject
{
if (m_objectInstances.ContainsKey(typeof(T)))
{
List<EngineObject> objectList = m_objectInstances[typeof(T)];
return (T) objectList.Find(obj => obj.ID == objectId);
}
return default(T);
}
Thanks for testing that out!
I've found that if I supply the EngineObject type in the function prototype, as you suggested :
public T GetObject<T>(int objectId) where T: EngineObject
it compiles without any errors on x86. I still get the same compile error on the Xenon platform, but I'm halfway there now