Archive 17/01/2023.

[SOLVED] ->SetModel(cache->GetResource<Model>() need?

noals

hi,

well, i have 2 const char* and i try to load a model with it but i don’t understand what is needed.

i tryed

const char* modulePath;
const char* moduleTexturePath;

roomObject->SetModel(cache->GetResource<Model>(modulePath);
roomObject->SetMaterial(cache->GetResource<Material>(moduleTexturePath);

or

String mP(modulePath);
String mTP(moduleTexturePath);

roomObject->SetModel(cache->GetResource<Model>(mP);
roomObject->SetMaterial(cache->GetResource<Material>(mTP);

of course, my const char* aren’t empty and return the path for the model and for the material file, i verified, but it doesn’t compile so i wonder.

quote from the api :

[quote]Resource * GetResource (StringHash type, const String &name, bool sendEventOnFailure=true)
Return a resource by type and name. Load if not loaded yet. Return null if not found or if fails, unless SetReturnFailedResources(true) has been called. Can be called only from the main thread. [/quote]

krokodilcapa

You’ve missed one more bracket from the ends. :slight_smile:

noals

lol, i’m so dumb sometimes. thank you.

krokodilcapa

You’re welcomed! I think it happens to every coder sometimes. :smiley:

Once I forgot to initialize a pointer to null, and I was searching for the crash reason for a whole day… of course the problem started few hours later after I implemented the class :open_mouth:

Modanung

Seems more like a dumb compiler to me. :wink:
In this case I’d expect an “expected ‘)’ before ‘;’ token” error.