Will Not Fix

Bolt v.2.0.0a5 Macros in Prefabs / Android Build

Marcel711 3 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 6

I have a Scene Variable of Type GameObject for a Prefab.

This Prefab has a Bolt Macro on it.

I use this Scene Variable in a Spawner to randomly spawn these Prefabs in the scene.

In the Editor GameView everything works. However when I build for Android and test it on a device the Prefabs no longer appear in the scene.

Is this a bug or can't I use Bolt Macros on Prefabs?

Bolt Version:
Bolt v.2.0.0a5
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
Bolt 2

ok, I found something out: If I assign the Scene Variable to a Instance of the Prefab in the Scene Hierarchy it works but not when I choose the same Prefab from the Assets folder. I'm new to Unity and Bolt, so please let me know if this is normal behaviour. Thanks!

Need More Information

Hi Marcel,

Sorry you're experiencing issues. We need an error log or reproduction steps to be able to help. Can you enable "Debug Build" when building to Android so that the error shows?

Also, make sure you run AOT Pre-Build (under Tools > Ludiq) before building for AOT platforms like Android.

Scratch that, I thought you were using Bolt 1 for a second. 

Hi Lazlo,

thank you for your reply.

The reproduction steps are:

  • New project in Unity 2018.3.12f1
  • Switch Platform to Android
  • Change API Comp Level to .NET 4.x
  • Import Bolt 2.0.0a5
  • Restart Unity
  • Run Full Extract
  • Create Cube
  • Add Flow Machine to this Cube
  • Add Macro to Flow Machine
  • As an example I simply added a "Tween Position" on the Start Event
  • Create a prefab of that cube
  • Remove the cube from scene hierarchy
  • Add new scene variable of type GameObject and assign the cube prefab from the assets
  • Create empty GameObject
  • Add FlowMachine
  • Add Macro
  • On Start Event: Add Instantiate Unit and use the value from the scene variable
  • Generate C# Scripts
  • Test in GameView -> Cube moves
  • Add scene in build settings
  • Build and test on Android Emulator -> Cube doesn't move

    Hope this helps, let me know if you need more info to reproduce.
    I couldn't find "Debug Build", only "Development Build" however where do I find the Error logs?

    I'm really liking Bolt and how easy it makes sripting in Unity, thanks for all your effort!!

Hi Lazlo,

could you replicate the problem?

Pending Review

Hi Marcel,

Sorry for the late reply, I was on vacation for the past two weeks. Thanks for the clear reproduction steps, I will try to recreate the issue with those and understand what's happening.

Will Not Fix

Hi Marcel,

Sorry for the very late reply on this issue. Seeing as this was an issue on a pre-classes alpha of Bolt 2, I'm assuming most of the internals that could be related have changed by now. I'll close it for now; let me know if you ever experience something similar with the new Class Variable system and the revamped code generation.