Welcome to the Game Creator support forum!
This a place to ask questions, discuss ideas and report bugs. Please, provide your Unity and Game Creator versions as well as clear reproduction steps when opening a topic and full console logs.
This just happens with Instantiate from pool Action. It doesn't happen with Instantiate Action.
A weird behavior I found when using Instantiate from pool, was the prefab I'm instantiating gets toggled off the moment the first prefab is instantiated, but the clones work just fine. However, I have to make sure to enable the object in the prefab before running the game again. Image:
I also got some other errors and warnings. The NullReferenceException and Unexpected top level layout group popped out of nowhere.
The "Some objects were not cleaned up..." popped up after exiting play mode while using the Instantiate Action. This does not happen with Instantiate from pool.
Okay, step by step. The prefab being disabled is by design. I was hoping this would not be noticed, but seems it didn't go as planned :-P The reason why it disables the prefab is that, when instantiating the first instance, the pool automatically generates 50 instances (by default, but this can be changed) and disables them.
If the prefab wasn't disabled, the 50 instances would be active for a single frame, hence calling On Start Triggers and any other initialization methods attached. To solve this, we disable the prefab, creating disabled instances and postponing their initialization to whenever it is required.
On the other hand, creating instances of Characters using the pool system is not something we had contemplated. We'll open a ticket and have a look at it.
About the warnings, I wouldn't worry too much. When a character is instantiated using the Pool system it gets instantiated at position (0,0,0), which might not have a NavMesh nearby (hence the error). But this is not game breaking, since when the character is properly used, it should be teleported to a correct navmesh location.
These warnings are from Unity and there's little I can do about them. Just mind that they do not affect the gameplay experience.
I created a State asset and put it in Change Player State Action. Later I deleted the State asset, then changed the Change Player State Action to another Action. I pressed play, and got this error. Restarting Unity fixes this.
This error comes from Unity's codebase. Seems it didn't fully remove the reference, but restarting Unity flushes it and should work fine. Nothing will be broken afterwards.
I was trying to figure out why in some cases Floating text generates NullReferenceExeptions. This is what I found:
Simple scene as in screenshot ( two cubes with trigger on start and action floating text ).
If cube1 and cube2 are enabled - hit play – all is OK.
If cube1 is enabled and cube2 is disabled - hit play – enable cube2 – all is OK .
If cube1 and cube2 are disabled – hit play – enable cube1 or cube2 – NullReferenceExeption (screenshot and log below )
NullReferenceException: Object reference not set to an instance of an object
GameCreator.Messages.FloatingMessageManager+d__7.MoveNext () (at Assets/Plugins/GameCreator/Messages/FloatingMessage/Mono/FloatingMessageManager.cs:51)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
GameCreator.Messages.FloatingMessageManager:Show(String, Color, Transform, Vector3, Single) (at Assets/Plugins/GameCreator/Messages/FloatingMessage/Mono/FloatingMessageManager.cs:42)
GameCreator.Messages.d__7:MoveNext() (at Assets/Plugins/GameCreator/Messages/FloatingMessage/ActionFloatingMessage.cs:42)
GameCreator.Core.d__3:MoveNext() (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IAction.cs:34)
GameCreator.Core.d__10:MoveNext() (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:29)
GameCreator.Core.ActionCoroutine:.ctor(IEnumerator) (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:24)
GameCreator.Core.d__9:MoveNext() (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:109)
GameCreator.Core.IActionsList:Execute(GameObject, Action, Object) (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:91)
GameCreator.Core.Actions:Execute(GameObject, Object) (at Assets/Plugins/GameCreator/Core/Mono/Interaction/Actions.cs:96)
GameCreator.Core.Trigger:Execute(GameObject, Object) (at Assets/Plugins/GameCreator/Core/Mono/Interaction/Trigger.cs:199)
GameCreator.Core.Igniter:ExecuteTrigger(GameObject, Object) (at Assets/Plugins/GameCreator/Core/Mono/Igniters/Igniter.cs:66)
GameCreator.Core.Igniter:ExecuteTrigger(GameObject) (at Assets/Plugins/GameCreator/Core/Mono/Igniters/Igniter.cs:59)
GameCreator.Core.IgniterStart:Start() (at Assets/Plugins/GameCreator/Core/Mono/Igniters/IgniterStart.cs:16)
Same error is observed in a similar scene – one cube only with simple behavior ( task -> floating text ) – NullReferenceExeption. If you have in a scene a second object with floating text action, behavior does not generate error.
This is one of those esoteric issues that seem strange, but make sense once you know them. But first of all, the solution:
Game Creator needs a way to identify the primary camera. This is usually set up when using a Camera Motor, but since you don't have one in your scene you can do one of the following:
- Tag the Main Camera object with the MainCamera tag
- Add the Camera Controller component to the Main Camera
Either if them is fine. I'm posting below the explanation of why this is happening, just in case you're interested :-)
The thing is that the first time the Floating Message is set up, it creates a Canvas object and sets it to World Space. In order to appear in world space, it requires a reference to the camera that is going to be used for rendering the UI. And here was the problem: I assumed there's one that either has the "MainCamera" tag or has the HookCamera component (automatically added by the Camera Controller component).
I'l try to improve the message error so it gives you a better idea of what's missing. Thanks for the heads up!
I'm trying to do the following and I'm finding I need so many actions and conditions:
- Clear dirt patch
- Get plant seed (picking one up from a set lying on the ground)
- Plant seed
- Water seed
- After some time, plant finishes growing
- Harvest crop
The reason it's so difficult is because I have multiple plants. What I'm doing right now is when I 'Get plant seed', I store a variable for what seed I have. Then when I plant, I check that variable. Depending on what seed I have, I perform a set of actions, which generally consists of 'Set Active a prefab on the dirt patch to represent first stage of crop growth' and 'Set a state to a local variable'. So if I have 8 different possible seeds I can plant, I'd need 8 different sets of actions. I'd also need 8 conditions saying 'If it's ____ seed', do '____ seed's Action'. Also, each time I interact with the dirt patch, I have to check what state it's in. Depending on the state (dry, watered, dead), I'd have to perform a different set of actions. This quickly gets very cumbersome.
Agree, but there are some things you can do to "share" code (Actions in this case) between different plans. Let's say you have a Fire Plant that takes 5 seconds to grow and gives you 3 Fire Seeds. Then, you also have a Water Plant that takes 10 seconds to grow and gives you 1 Water Seed.
You could have a bunch of Global Variables of type Game Object that reference the prefab objects of each plant. For example, global variable "fire-plant" would reference a Fire Plant prefab, and "water-plant" would reference a Water Plant prefab.
Now this is very useful because when you plant a plant, you simply instantiate a game object from the variable you want. You can have an "On Start" Trigger in each plant that will execute an Actions that waits a few seconds (5 for Fire Plant and 10 for Water Plant) and changes the 3D model onto one that looks like a fully blossomed plant.
You could also add a Local Variable "is-dead" to all plants as well as a "water-need" variable, that starts at different values depending on the seed. An "On Start" Trigger could start lowering the "water-need" at fixed timesteps, and if the value reaches 0, it changes the value of "is-dead" to true. Watering a plant would simply increase the "water-need" numeric variable.
The idea would be having each seed/plant as an individual prefab and everything work very systemic-wise. Moreover, you could also make use of the "Execute Actions" action, which allows you to execute an Actions component from a game object (that can come from a Local Variable).
If you have a particular thing you want to have explained, feel free to ask. This looks like a very interesting project
Any way to set the volume for an individual sound via the Play sound action? i may have a few different sounds in the scene, and would like them at different volumes. Using the Play Sound doesn't allow for a volume modifier. any suggestions?
or anyway to execute a AudioSource to the Play Sound via the audio manager?
Hi Alienmadness. The Play Sound, as you mention, doesn't allow to change the volume of that particular sound. This should be ideally done in an external program and import the sound effect with the correct volume. The reason being that we have a separate volume layer for different kind of audios:
- Sound Effects
- Voices (coming soon)
However, if you still want to play a sound and modify its volume from Unity, as you said, you can do that interacting with the AudioSource component. You just need to enable the "Play On Awake" option in that component. To play this AudioSource component, disable and enable it using the "Set Active" action.
Hope this helps! Happy game making!
Having a issue: After I change the unity project ( product name ) in player settings, there is a issue with character movement. The Character Movement issue only appears after the build. Works perfect in the editor, not after building. Also I am not getting any console error messages. I think this is a bug.
Yeah definitely. It was a nice addition. We're just temporally removing it to identify the problem. We don't normally do this, but since we haven't been able to reproduce this problem, we're stripping everything we believe might be the case and reimplement it later. But for now, this will allow us assess whether the problem is here or not.
By the way, I'm marking the issue as Fixed, because I've already stripped all the necessary code. Tomorrow there should be a new Game Creator update available with this fix. If you still experience problems, feel free to reopen the ticket here.
so I created a health stat variable on my characters and I want to work with this variable further by adding a 'hurt state' if the health falls below a certain value and then ultimately "kill" the character when the health is on 0.
So far I have been able to change this var by colliding the enemy with my bullets, but nothing changes when my values are reached.
In my case, I use a local variable enemy_health, that has a default value of 100.
I have set a condition that checks if the variable value is equal or less than 25, then the character should become "hurt".
Same goes for checking if the health is equal or less than 0, then the character should turn into a ragdoll.
None of these actions ever start when reaching my designated values. Am I missing something?
Seems like you are missing a Trigger. Actions are list of instructions that are sequentially executed. Conditions, allow to execute different Actions based on Conditions.
Both of these systems require a Trigger to be executed. A Condition alone don't listen for scene events. You'll probably want a Trigger set to "On Variable Change". This trigger will be executed every time a given Local Variable changes its value. You can then execute the Conditions you already made and change the State of the Player for the one called Hurt, or kill it if the variable value is below zero.
Hope this helps!
the timescale seems to effect the audio component of the UI.
for example when i set the timescale to 0 to pause the game. i can no longer hear the UI clicks. This may have been with the recent 1.0.2 update or the inventory module (just purchased and installed it).
I would see this as within core GameCreator - as the resultant Actions would then be vv useful in the Modules as well - particularly the Behaviour Module, Quest Module, etc. Basically Actions controlling the weather if the Weather Asset is also compatible (as most are) with WAPI.... ;)
Also when switching from a tween camera to a first person camera, the first person camera tracks to the right of where the marker is facing. I've also tried using a separate first person camera and I'm having the same issue with it.
Okay, this was a bit more complex than expected. I changed how the Teleport works so you will now have an option to rotate the Character towards where the Marker points at. This change also affected other Game Creator scripts, so I just can't post them here, since there are some dependencies. You'll have to wait for the next update.
On the other hand, there's still another issue. When teleporting a Character, if the Character has the Face Direction property set to Camera Direction, even if the character copies the direction of the Marker when teleporting, the camera will still keep its rotation, making the character immediately rotate where the camera looks at.
There's a solution for this too, however, which is creating another FPS Camera Motor and switching to this one AFTER the Teleport. When changing to a FPS motor, it's first positioned behind the Player, which is exactly what you want.
Hope this is clear. I'm closing this topic, since the fix is already done and will be available with version 1.0.3. Feel free to keep posting, however, if something wasn't clear. Cheers!
Customer support service by UserEcho