Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instance of prefab issue ?? #49

Open
pmyn opened this issue May 20, 2012 · 9 comments
Open

Instance of prefab issue ?? #49

pmyn opened this issue May 20, 2012 · 9 comments

Comments

@pmyn
Copy link

pmyn commented May 20, 2012

Hello, i have question about object Instantiate; I have following code :

for (int index = 0; index < Projectiles.Length; index++)
{
Projectiles[index] = (GameObject)Instantiate(Project, transform.position, transform.rotation);
Projectiles[index].SetActiveRecursively(false);
Projectiles[index].active = false;
}
When the projectile i shoot i active object :
Projectiles[index].SetActiveRecursively(true); Projectiles[index].active = true;
and when is colision with object i do :
Projectiles[index].SetActiveRecursively(false); Projectiles[index].active = false;

but in the scene on XNA all projectile is set active to false and i ahve big problem. Can you help me with this issue ?? In unity evrythink is okey.

@fehaar
Copy link
Owner

fehaar commented May 21, 2012

So what you say is that the projectile is not activated when the activation code is run? And you say that it is the gameobject that is non-active, not just the rendering?

I will try to make a test scene that does the same as you are doing and see if I can spot the problem. Otherwise, if you can share your code I will be happy to take a look at it.

@pmyn
Copy link
Author

pmyn commented May 21, 2012

Projectile is visible and all work autonomus, diffrent speed etc itp. But when i SetRecursiveState(false) on one projectile, all particle for some millisecond blink but i invoke SetRecursiveState(false) on one projectile.
I resolve problem at night by ApplicationSettings.UseFallbackRendering = true; (no blink when deactivated) But when i change color on one projectile (renderer.material, renderer.sharedMaterial) all projectile change color.I post some code (and movie issue effect) when i come back to home. Otherwise great framework :)

@fehaar
Copy link
Owner

fehaar commented May 21, 2012

Ok. I had the feeling that this could be a problem in the new renderer. Godd to know that the fallback renderer works at least. The shared material system is not quite done yet, so if you want to avoid the color change issue, you should set a new material for each projectile after the instantiate for the moment.

@pmyn
Copy link
Author

pmyn commented May 21, 2012

I have also OffTopic question : A variable autoDestruct on particle emmiters is work ?? I look in code :
if (destroy && autodestruct)
{

            Destroy(gameObject);
        }

autodestruct i set to true but destroy always false.

@fehaar
Copy link
Owner

fehaar commented May 21, 2012

destroy will be set in FixedUpdate if the Animator have had particles
and does not have any active anymore - as far as I can tell. So
autodestruct should run when the particle system is done - which will
usually only be the case for OneShot systems or if you shut down
emission in a script.

Thomas Gravgaard
Senior Software Developer
Press Play ApS
thomas@pressplay.dk
+45 26 74 26 74

@pmyn
Copy link
Author

pmyn commented May 21, 2012

yeah, OneShots in set to true. Ok i will work with this, Thanks for answer .

@pmyn
Copy link
Author

pmyn commented May 21, 2012

I see now Unity Exporter don't export OneShots Variable, so it must be set on script :)

@fehaar
Copy link
Owner

fehaar commented May 21, 2012

Yeah. It is one of the "internal" Unity variables that you cannot get
to in scripts, so we cannot export it. You should use the provided
script FFWD_EllipsoidParticleEmitter for exporting that value (and the
other hidden particle system values). Just attach it to the same
gameobject as your particle system and duplicate the values. Extremely
annoying - but better than remembering to do it in code all the time.

@pmyn
Copy link
Author

pmyn commented May 21, 2012

Really Thanks, i don't see before this exporters script ;) Sorry for take a time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants