Changing Enemy Prefab Variable (MoveSpeed) at Runtime

Hey Guys,

I just started working with Unity3D after a long period of working with the Unreal Development Kit. I believe that i know what i’m doing but i’m having issues with the following:

How can i increase the MoveSpeed variable of my prefab enemy when the player levels up (during runtime)?

I’m instantiating the enemies using a spawnpoint object.
The PlayerLevel class is in the player object.
Spawnpoint is an object.
Enemy is a prefab.

I tried alot of things allready and i made a really long post with screenshots but that post got deleted because i had to register to unityAnswers first :confused:

If more info is needed i will provide more.

Thanks in advance guys

So many ways to do this!

Another way would be to tag all the enemies with, say an ‘enemy’ tag. Then do a FindGameObjectsWithTag, then in your enemy script, have a method called “ChangeSpeed”.
Then simply do a SendMessage(“ChangeSpeed”,whateverspeed); to all those gameobjects.

OR

Parent all the enemies to an empty game object (“EnemyContainer”?), and call BroadcastMessage on that gameObject when the player levels up.