[SOLVED]Storing Pointer in Node Var

Does anyone know how to safely store and retrieve a pointer stored in Node Var, I tried it didn’t work out well. First I set the node var

Sprite* sprt = ... ;
myNode->SetVar("Sprite", sprt);

then I tried to retrieve it like this

Sprite* mySprite = static_cast<Sprite*>(myNode->GetVar("Sprite")->GetPtr();

but it throws up some ugly compiler error.

I would be glad if anyone that has gotten this kind of stuff right can show me the way forward :slight_smile:

You’re missing one “)” at least before “;”. Is it simply that?

Edit: Also, for future reference, please post the compiler output too for any possible compilation problems.

[quote=“Stinkfist”]You’re missing one “)” at least before “;”. Is it simply that?

Edit: Also, for future reference, please post the compiler output too for any possible compilation problems.[/quote]

the missing bracket was actually a typo made while posting… But thanks anyway was able to figure out what went wrong and it turned out my code was not at fault :slight_smile: