Dynamic Static Mesh Alteration

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

aardvarkk

New Member
May 7, 2004
64
0
0
Boy is this one bothersome!

The problem is that I'm trying to use an Actor's SetStaticMesh function to no avail. There are essentially zero references to this information online and I have no idea why -- it would seem to be a very useful thing to do!

In the only reference to this function I can really use (searching google for setstaticmesh and going to the Hot Potato mod) the following line is used:


Code:
SetStaticMesh(StaticMesh'XGame_RC.BombEffectMesh');
whereas my code is:


Code:
SetStaticMesh(StaticMesh'ConveyorMeshes.GlobeFixed');
I get an error when compiling stating that:

Error, Can't find StaticMesh 'ConveyorMeshes.GlobeFixed'

The perplexing thing is, if I just set the default property as:


Code:
defaultproperties
{
  StaticMesh=StaticMesh'ConveyorMeshes.GlobeFixed'
}
everything is fine and the mesh works ingame.

So the question is, why can't it find the mesh when I try to use SetStaticMesh but it can find it when I set it through default properties?

Thanks for any help you can give me, this one is quite the bother.
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Default properties are imported last, after all the code of all classes has been compiled. You could probably use an #EXEC directive to load the static mesh package or add it to the EditPackages so the compiler knowns what's going on.

Try adding "#exec obj load file=..\StaticMeshes\ConveyorMeshes.usx" at the top of the class the static mesh reference is in. Adjust path and file name according to your package.
 

Rigear

Cruncher of Code
Mar 21, 2004
4
0
0
Or if you don't like using the OBJ LOAD directives, since they then become hardcoded and can not be changed via changing paths in the ini.

you can also create a new staticmesh variable, and then pass that into the SetStaticMesh() function. and then all you need to do is in the default properties is set that new variable to whatever staticmesh u want it to be :p


List so

Code:
Var staticmesh NewMesh;

function Whatever()
{
     SetStaticMesh(NewMesh);
}

Default Properties
{
     NewMesh=StaticMesh'Pack.MaMesh'
}